package com.chixing.ih.module.admin.mapper;

import com.chixing.ih.module.admin.mapper.Provider.AdminUserMapperProvider;
import com.chixing.ih.module.system.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminUserMapper {

    @SelectProvider(type = AdminUserMapperProvider.class, method = "getOrdinaryUser")
    @Results(id = "userMap", value = {
            @Result(id = true, column = "user_id", property = "userId"),
            @Result(column = "user_account", property = "userAccount"),
            @Result(column = "nick_name", property = "nickName"),
            @Result(column = "user_password", property = "userPassword"),
            @Result(column = "user_telephone", property = "userTelephone"),
            @Result(column = "user_status", property = "userStatus"),
            @Result(column = "user_career", property = "userCareer"),
            @Result(column = "user_career_direct", property = "userCareerDirect"),
            @Result(column = "user_position", property = "userPosition"),
            @Result(column = "user_company", property = "userCompany"),
            @Result(column = "user_email", property = "userEmail"),
            @Result(column = "support_num", property = "supportNum"),
            @Result(column = "alipay_account", property = "alipayAccount"),
            @Result(column = "wechat_account", property = "wechatAccount"),
            @Result(column = "qq_account", property = "qqAccount"),
            @Result(column = "role_id", property = "roleId"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "update_time", property = "updateTime"),
            @Result(column = "is_deleted", property = "isDeleted")
    })
    List<User> getOrdinaryUser(String keyword);

    @SelectProvider(type = AdminUserMapperProvider.class, method = "getVipUser")
    @ResultMap("userMap")
    List<User> getVipUser(String keyword);

    @SelectProvider(type = AdminUserMapperProvider.class, method = "getBlacklistedUser")
    @ResultMap("userMap")
    List<User> getBlacklistedUser(String keyword);


    @UpdateProvider(type = AdminUserMapperProvider.class, method = "addToBlacklist")
    boolean addToBlacklist(Integer id);

    @UpdateProvider(type = AdminUserMapperProvider.class, method = "removeToBlacklist")
    boolean removeToBlacklist(Integer id);


    @SelectProvider(type = AdminUserMapperProvider.class, method = "getUserMail")
    String getUserMail(Integer id);

}
